package com.dxg.msns.dynamic.mapper;

import com.dxg.msns.dynamic.pojo.Report;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;


@org.apache.ibatis.annotations.Mapper
public interface ReportMapper extends Mapper<Report> {
    @Select("select * from report where dynamic_id = #{dynamicId}")
    @Results(value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "dynamic_id", property = "dynamicId"),
            @Result(column = "reason", property = "reason")
    })
    List<Report> findById(@Param("dynamicId") String dynamicId);

    @Select("SELECT * FROM report ORDER BY upload_time DESC")
    @Results(value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "title", property = "title"),
            @Result(column = "context", property = "context"),
            @Result(column = "upload_time", property = "uploadTime")
    })
    List<Report> findAllReportsOrderByLatest();


}
